package algorithms.que12;

/**
 * @功能
 * @创建时间 2020/6/21
 */
public class StmartDate11 {
    private int month;

    private int day;

    private int year;

    private int[] run = {1,3,5,7,8,10,12};
    public StmartDate11(int month, int day, int year) throws DayWrongException {
        if(month>12&&day>31&&month<=0&&day<=0&&year<=0)
            throw new DayWrongException("eqeqeq");
        this.month = month;
        this.day = day;
        this.year = year;
    }
    public String dayOfTheWeek()
    {
        int w=(year%100+(year%100)/4+(year-year%100)/4-2*(year-year%100)+
                26*(month+1)/10+day-1)%7;
        if(w<0) w=w+7;
        String weekstr="";
        switch(w)
        {
            case 0: weekstr="Sunday"; break;
            case 1: weekstr="Monday"; break;
            case 2: weekstr="Tuesday"; break;
            case 3: weekstr="Wednesday"; break;
            case 4: weekstr="Thursday"; break;
            case 5: weekstr="Friday"; break;
            case 6: weekstr="Saturday"; break;
        }
        return weekstr;
    }
    @Override
    public String toString() {
        return "StmartDate11{" +
                "month=" + month +
                ", day=" + day +
                ", year=" + year +
                '}';
    }
}
